package com.arrogames.rgblabyrinth.game.trigger.effect {
	import com.arrogames.rgblabyrinth.game.EntityCreator;
	
	public class Effect {
		
		protected var effect:IEffect;
		protected var executions:int;
		
		public function Effect(effect:IEffect, executions:int=1) {
			if (executions < 1) {
				throw new Error("Executions on a effect must be at least 1.");
			}
			this.effect = effect;
			this.executions = executions;
		}
		
		public function execute(creator:EntityCreator):void {
			effect.execute(creator);
			executions--;
		}
		
		public function get executionsLeft():int {
			return executions;
		}
	}
}